home *** CD-ROM | disk | FTP | other *** search
/ Erotic Games: Memory / Erotic Games: Memory.iso / mac / air_installers / AdobeAIR.exe / setup.swf / scripts / mx / controls / TextInput.as < prev    next >
Text File  |  2009-02-12  |  29KB  |  921 lines

  1. package mx.controls
  2. {
  3.    import flash.accessibility.AccessibilityProperties;
  4.    import flash.display.DisplayObject;
  5.    import flash.events.Event;
  6.    import flash.events.FocusEvent;
  7.    import flash.events.KeyboardEvent;
  8.    import flash.events.TextEvent;
  9.    import flash.system.IME;
  10.    import flash.system.IMEConversionMode;
  11.    import flash.text.TextField;
  12.    import flash.text.TextFieldAutoSize;
  13.    import flash.text.TextFieldType;
  14.    import flash.text.TextLineMetrics;
  15.    import flash.ui.Keyboard;
  16.    import mx.controls.listClasses.BaseListData;
  17.    import mx.controls.listClasses.IDropInListItemRenderer;
  18.    import mx.controls.listClasses.IListItemRenderer;
  19.    import mx.core.EdgeMetrics;
  20.    import mx.core.FlexVersion;
  21.    import mx.core.IDataRenderer;
  22.    import mx.core.IFlexDisplayObject;
  23.    import mx.core.IFlexModuleFactory;
  24.    import mx.core.IFontContextComponent;
  25.    import mx.core.IIMESupport;
  26.    import mx.core.IInvalidating;
  27.    import mx.core.IRectangularBorder;
  28.    import mx.core.IUITextField;
  29.    import mx.core.UIComponent;
  30.    import mx.core.UITextField;
  31.    import mx.core.mx_internal;
  32.    import mx.events.FlexEvent;
  33.    import mx.managers.IFocusManager;
  34.    import mx.managers.IFocusManagerComponent;
  35.    import mx.styles.ISimpleStyleClient;
  36.    
  37.    use namespace mx_internal;
  38.    
  39.    public class TextInput extends UIComponent implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IIMESupport, IListItemRenderer, IFontContextComponent
  40.    {
  41.       
  42.       mx_internal static const VERSION:String = "3.0.0.0";
  43.        
  44.       
  45.       private var _text:String = "";
  46.       
  47.       private var _textWidth:Number;
  48.       
  49.       private var _restrict:String;
  50.       
  51.       private var htmlTextChanged:Boolean = false;
  52.       
  53.       mx_internal var border:IFlexDisplayObject;
  54.       
  55.       private var enabledChanged:Boolean = false;
  56.       
  57.       private var _maxChars:int = 0;
  58.       
  59.       private var _condenseWhite:Boolean = false;
  60.       
  61.       private var accessibilityPropertiesChanged:Boolean = false;
  62.       
  63.       private var _textHeight:Number;
  64.       
  65.       private var displayAsPasswordChanged:Boolean = false;
  66.       
  67.       private var prevMode:String = null;
  68.       
  69.       private var selectableChanged:Boolean = false;
  70.       
  71.       private var restrictChanged:Boolean = false;
  72.       
  73.       private var selectionChanged:Boolean = false;
  74.       
  75.       private var _data:Object;
  76.       
  77.       private var maxCharsChanged:Boolean = false;
  78.       
  79.       private var _tabIndex:int = -1;
  80.       
  81.       private var errorCaught:Boolean = false;
  82.       
  83.       private var _selectionBeginIndex:int = 0;
  84.       
  85.       private var explicitHTMLText:String = null;
  86.       
  87.       private var editableChanged:Boolean = false;
  88.       
  89.       mx_internal var parentDrawsFocus:Boolean = false;
  90.       
  91.       private var tabIndexChanged:Boolean = false;
  92.       
  93.       private var _horizontalScrollPosition:Number = 0;
  94.       
  95.       private var _editable:Boolean = true;
  96.       
  97.       private var _imeMode:String = null;
  98.       
  99.       private var condenseWhiteChanged:Boolean = false;
  100.       
  101.       protected var textField:IUITextField;
  102.       
  103.       private var _listData:BaseListData;
  104.       
  105.       private var _displayAsPassword:Boolean = false;
  106.       
  107.       private var textChanged:Boolean = false;
  108.       
  109.       private var _htmlText:String = "";
  110.       
  111.       private var _accessibilityProperties:AccessibilityProperties;
  112.       
  113.       private var _selectionEndIndex:int = 0;
  114.       
  115.       private var textSet:Boolean;
  116.       
  117.       private var horizontalScrollPositionChanged:Boolean = false;
  118.       
  119.       private var _selectable:Boolean = true;
  120.       
  121.       public function TextInput()
  122.       {
  123.          super();
  124.          tabChildren = true;
  125.       }
  126.       
  127.       public function get imeMode() : String
  128.       {
  129.          return _imeMode;
  130.       }
  131.       
  132.       public function set imeMode(param1:String) : void
  133.       {
  134.          _imeMode = param1;
  135.       }
  136.       
  137.       override protected function focusOutHandler(param1:FocusEvent) : void
  138.       {
  139.          super.focusOutHandler(param1);
  140.          if(_imeMode != null && _editable)
  141.          {
  142.             if(IME.conversionMode != IMEConversionMode.UNKNOWN && prevMode != IMEConversionMode.UNKNOWN)
  143.             {
  144.                IME.conversionMode = prevMode;
  145.             }
  146.             IME.enabled = false;
  147.          }
  148.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  149.       }
  150.       
  151.       override public function drawFocus(param1:Boolean) : void
  152.       {
  153.          if(mx_internal::parentDrawsFocus)
  154.          {
  155.             IFocusManagerComponent(parent).drawFocus(param1);
  156.             return;
  157.          }
  158.          super.drawFocus(param1);
  159.       }
  160.       
  161.       mx_internal function getTextField() : IUITextField
  162.       {
  163.          return textField;
  164.       }
  165.       
  166.       private function textField_textInputHandler(param1:TextEvent) : void
  167.       {
  168.          param1.stopImmediatePropagation();
  169.          var _loc2_:TextEvent = new TextEvent(TextEvent.TEXT_INPUT,false,true);
  170.          _loc2_.text = param1.text;
  171.          dispatchEvent(_loc2_);
  172.          if(_loc2_.isDefaultPrevented())
  173.          {
  174.             param1.preventDefault();
  175.          }
  176.       }
  177.       
  178.       override public function get accessibilityProperties() : AccessibilityProperties
  179.       {
  180.          return _accessibilityProperties;
  181.       }
  182.       
  183.       override protected function createChildren() : void
  184.       {
  185.          super.createChildren();
  186.          createBorder();
  187.          createTextField(-1);
  188.       }
  189.       
  190.       private function textFieldChanged(param1:Boolean, param2:Boolean) : void
  191.       {
  192.          var _loc3_:* = false;
  193.          var _loc4_:* = false;
  194.          if(!param1)
  195.          {
  196.             _loc3_ = _text != textField.text;
  197.             _text = textField.text;
  198.          }
  199.          _loc4_ = _htmlText != textField.htmlText;
  200.          _htmlText = textField.htmlText;
  201.          if(_loc3_)
  202.          {
  203.             dispatchEvent(new Event("textChanged"));
  204.             if(param2)
  205.             {
  206.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  207.             }
  208.          }
  209.          if(_loc4_)
  210.          {
  211.             dispatchEvent(new Event("htmlTextChanged"));
  212.          }
  213.          _textWidth = textField.textWidth;
  214.          _textHeight = textField.textHeight;
  215.       }
  216.       
  217.       [NonCommittingChangeEvent("change")]
  218.       [Bindable("textChanged")]
  219.       public function get text() : String
  220.       {
  221.          return _text;
  222.       }
  223.       
  224.       mx_internal function createTextField(param1:int) : void
  225.       {
  226.          if(!textField)
  227.          {
  228.             textField = IUITextField(createInFontContext(UITextField));
  229.             textField.autoSize = TextFieldAutoSize.NONE;
  230.             textField.enabled = enabled;
  231.             textField.ignorePadding = false;
  232.             textField.multiline = false;
  233.             textField.tabEnabled = true;
  234.             textField.wordWrap = false;
  235.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  236.             {
  237.                textField.styleName = this;
  238.             }
  239.             textField.addEventListener(Event.CHANGE,textField_changeHandler);
  240.             textField.addEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  241.             textField.addEventListener(Event.SCROLL,textField_scrollHandler);
  242.             textField.addEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  243.             textField.addEventListener("textFormatChange",textField_textFormatChangeHandler);
  244.             textField.addEventListener("textInsert",textField_textModifiedHandler);
  245.             textField.addEventListener("textReplace",textField_textModifiedHandler);
  246.             if(param1 == -1)
  247.             {
  248.                addChild(DisplayObject(textField));
  249.             }
  250.             else
  251.             {
  252.                addChildAt(DisplayObject(textField),param1);
  253.             }
  254.          }
  255.       }
  256.       
  257.       override public function get tabIndex() : int
  258.       {
  259.          return _tabIndex;
  260.       }
  261.       
  262.       override public function set accessibilityProperties(param1:AccessibilityProperties) : void
  263.       {
  264.          if(param1 == _accessibilityProperties)
  265.          {
  266.             return;
  267.          }
  268.          _accessibilityProperties = param1;
  269.          accessibilityPropertiesChanged = true;
  270.          invalidateProperties();
  271.       }
  272.       
  273.       public function setSelection(param1:int, param2:int) : void
  274.       {
  275.          _selectionBeginIndex = param1;
  276.          _selectionEndIndex = param2;
  277.          selectionChanged = true;
  278.          invalidateProperties();
  279.       }
  280.       
  281.       [Bindable("condenseWhiteChanged")]
  282.       public function get condenseWhite() : Boolean
  283.       {
  284.          return _condenseWhite;
  285.       }
  286.       
  287.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  288.       {
  289.          return param1 == textField || super.isOurFocus(param1);
  290.       }
  291.       
  292.       [Bindable("displayAsPasswordChanged")]
  293.       public function get displayAsPassword() : Boolean
  294.       {
  295.          return _displayAsPassword;
  296.       }
  297.       
  298.       public function set data(param1:Object) : void
  299.       {
  300.          var _loc2_:* = undefined;
  301.          _data = param1;
  302.          if(_listData)
  303.          {
  304.             _loc2_ = _listData.label;
  305.          }
  306.          else if(_data != null)
  307.          {
  308.             if(_data is String)
  309.             {
  310.                _loc2_ = String(_data);
  311.             }
  312.             else
  313.             {
  314.                _loc2_ = _data.toString();
  315.             }
  316.          }
  317.          if(_loc2_ !== undefined && !textSet)
  318.          {
  319.             text = _loc2_;
  320.             textSet = false;
  321.          }
  322.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  323.       }
  324.       
  325.       public function get selectionBeginIndex() : int
  326.       {
  327.          return !!textField ? int(textField.selectionBeginIndex) : int(_selectionBeginIndex);
  328.       }
  329.       
  330.       mx_internal function get selectable() : Boolean
  331.       {
  332.          return _selectable;
  333.       }
  334.       
  335.       protected function createBorder() : void
  336.       {
  337.          var _loc1_:Class = null;
  338.          if(!mx_internal::border)
  339.          {
  340.             _loc1_ = getStyle("borderSkin");
  341.             if(_loc1_ != null)
  342.             {
  343.                border = new _loc1_();
  344.                if(mx_internal::border is ISimpleStyleClient)
  345.                {
  346.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  347.                }
  348.                addChildAt(DisplayObject(mx_internal::border),0);
  349.                invalidateDisplayList();
  350.             }
  351.          }
  352.       }
  353.       
  354.       [Bindable("horizontalScrollPositionChanged")]
  355.       public function get horizontalScrollPosition() : Number
  356.       {
  357.          return _horizontalScrollPosition;
  358.       }
  359.       
  360.       override protected function measure() : void
  361.       {
  362.          var _loc2_:Number = NaN;
  363.          var _loc3_:Number = NaN;
  364.          var _loc4_:TextLineMetrics = null;
  365.          super.measure();
  366.          var _loc1_:EdgeMetrics = mx_internal::border && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  367.          measuredWidth = DEFAULT_MEASURED_WIDTH;
  368.          if(maxChars)
  369.          {
  370.             measuredWidth = Math.min(measuredWidth,measureText("W").width * maxChars + _loc1_.left + _loc1_.right + 8);
  371.          }
  372.          if(!text || text == "")
  373.          {
  374.             _loc2_ = DEFAULT_MEASURED_MIN_WIDTH;
  375.             _loc3_ = measureText(" ").height + _loc1_.top + _loc1_.bottom + UITextField.TEXT_HEIGHT_PADDING;
  376.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  377.             {
  378.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  379.             }
  380.          }
  381.          else
  382.          {
  383.             _loc2_ = (_loc4_ = measureText(text)).width + _loc1_.left + _loc1_.right + 8;
  384.             _loc3_ = _loc4_.height + _loc1_.top + _loc1_.bottom + UITextField.TEXT_HEIGHT_PADDING;
  385.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  386.             {
  387.                _loc2_ += getStyle("paddingLeft") + getStyle("paddingRight");
  388.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  389.             }
  390.          }
  391.          measuredWidth = Math.max(_loc2_,measuredWidth);
  392.          measuredHeight = Math.max(_loc3_,DEFAULT_MEASURED_HEIGHT);
  393.          measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  394.          measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  395.       }
  396.       
  397.       public function get fontContext() : IFlexModuleFactory
  398.       {
  399.          return moduleFactory;
  400.       }
  401.       
  402.       public function set text(param1:String) : void
  403.       {
  404.          textSet = true;
  405.          if(!param1)
  406.          {
  407.             param1 = "";
  408.          }
  409.          if(!isHTML && param1 == _text)
  410.          {
  411.             return;
  412.          }
  413.          _text = param1;
  414.          textChanged = true;
  415.          _htmlText = null;
  416.          explicitHTMLText = null;
  417.          invalidateProperties();
  418.          invalidateSize();
  419.          invalidateDisplayList();
  420.          dispatchEvent(new Event("textChanged"));
  421.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  422.       }
  423.       
  424.       public function get selectionEndIndex() : int
  425.       {
  426.          return !!textField ? int(textField.selectionEndIndex) : int(_selectionEndIndex);
  427.       }
  428.       
  429.       [Bindable("editableChanged")]
  430.       public function get editable() : Boolean
  431.       {
  432.          return _editable;
  433.       }
  434.       
  435.       [Bindable("dataChange")]
  436.       public function get listData() : BaseListData
  437.       {
  438.          return _listData;
  439.       }
  440.       
  441.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  442.       {
  443.          switch(param1.keyCode)
  444.          {
  445.             case Keyboard.ENTER:
  446.                dispatchEvent(new FlexEvent(FlexEvent.ENTER));
  447.          }
  448.       }
  449.       
  450.       override protected function focusInHandler(param1:FocusEvent) : void
  451.       {
  452.          var message:String = null;
  453.          var event:FocusEvent = param1;
  454.          if(event.target == this)
  455.          {
  456.             systemManager.stage.focus = TextField(textField);
  457.          }
  458.          var fm:IFocusManager = focusManager;
  459.          if(editable && fm)
  460.          {
  461.             fm.showFocusIndicator = true;
  462.             if(textField.selectable && _selectionBeginIndex == _selectionEndIndex)
  463.             {
  464.                textField.setSelection(0,textField.length);
  465.             }
  466.          }
  467.          super.focusInHandler(event);
  468.          if(_imeMode != null && _editable)
  469.          {
  470.             IME.enabled = true;
  471.             prevMode = IME.conversionMode;
  472.             try
  473.             {
  474.                if(!errorCaught && IME.conversionMode != IMEConversionMode.UNKNOWN)
  475.                {
  476.                   IME.conversionMode = _imeMode;
  477.                }
  478.                errorCaught = false;
  479.             }
  480.             catch(e:Error)
  481.             {
  482.                errorCaught = true;
  483.                message = resourceManager.getString("controls","unsupportedMode",[_imeMode]);
  484.                throw new Error(message);
  485.             }
  486.          }
  487.       }
  488.       
  489.       [NonCommittingChangeEvent("change")]
  490.       [Bindable("htmlTextChanged")]
  491.       public function get htmlText() : String
  492.       {
  493.          return _htmlText;
  494.       }
  495.       
  496.       override public function set tabIndex(param1:int) : void
  497.       {
  498.          if(param1 == _tabIndex)
  499.          {
  500.             return;
  501.          }
  502.          _tabIndex = param1;
  503.          tabIndexChanged = true;
  504.          invalidateProperties();
  505.       }
  506.       
  507.       public function set restrict(param1:String) : void
  508.       {
  509.          if(param1 == _restrict)
  510.          {
  511.             return;
  512.          }
  513.          _restrict = param1;
  514.          restrictChanged = true;
  515.          invalidateProperties();
  516.          dispatchEvent(new Event("restrictChanged"));
  517.       }
  518.       
  519.       private function textField_textFieldStyleChangeHandler(param1:Event) : void
  520.       {
  521.          textFieldChanged(true,false);
  522.       }
  523.       
  524.       private function textField_changeHandler(param1:Event) : void
  525.       {
  526.          textFieldChanged(false,false);
  527.          textChanged = false;
  528.          htmlTextChanged = false;
  529.          param1.stopImmediatePropagation();
  530.          dispatchEvent(new Event(Event.CHANGE));
  531.       }
  532.       
  533.       override public function set enabled(param1:Boolean) : void
  534.       {
  535.          if(param1 == enabled)
  536.          {
  537.             return;
  538.          }
  539.          super.enabled = param1;
  540.          enabledChanged = true;
  541.          invalidateProperties();
  542.          if(mx_internal::border && mx_internal::border is IInvalidating)
  543.          {
  544.             IInvalidating(mx_internal::border).invalidateDisplayList();
  545.          }
  546.       }
  547.       
  548.       override public function get baselinePosition() : Number
  549.       {
  550.          var _loc1_:String = null;
  551.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  552.          {
  553.             _loc1_ = text;
  554.             if(_loc1_ == "")
  555.             {
  556.                _loc1_ = " ";
  557.             }
  558.             return (mx_internal::border && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics.top : 0) + measureText(_loc1_).ascent;
  559.          }
  560.          if(!validateBaselinePosition())
  561.          {
  562.             return NaN;
  563.          }
  564.          return textField.y + textField.baselinePosition;
  565.       }
  566.       
  567.       public function set condenseWhite(param1:Boolean) : void
  568.       {
  569.          if(param1 == _condenseWhite)
  570.          {
  571.             return;
  572.          }
  573.          _condenseWhite = param1;
  574.          condenseWhiteChanged = true;
  575.          if(isHTML)
  576.          {
  577.             htmlTextChanged = true;
  578.          }
  579.          invalidateProperties();
  580.          invalidateSize();
  581.          invalidateDisplayList();
  582.          dispatchEvent(new Event("condenseWhiteChanged"));
  583.       }
  584.       
  585.       public function get textWidth() : Number
  586.       {
  587.          return _textWidth;
  588.       }
  589.       
  590.       public function set displayAsPassword(param1:Boolean) : void
  591.       {
  592.          if(param1 == _displayAsPassword)
  593.          {
  594.             return;
  595.          }
  596.          _displayAsPassword = param1;
  597.          displayAsPasswordChanged = true;
  598.          invalidateProperties();
  599.          invalidateSize();
  600.          invalidateDisplayList();
  601.          dispatchEvent(new Event("displayAsPasswordChanged"));
  602.       }
  603.       
  604.       mx_internal function removeTextField() : void
  605.       {
  606.          if(textField)
  607.          {
  608.             textField.removeEventListener(Event.CHANGE,textField_changeHandler);
  609.             textField.removeEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  610.             textField.removeEventListener(Event.SCROLL,textField_scrollHandler);
  611.             textField.removeEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  612.             textField.removeEventListener("textFormatChange",textField_textFormatChangeHandler);
  613.             textField.removeEventListener("textInsert",textField_textModifiedHandler);
  614.             textField.removeEventListener("textReplace",textField_textModifiedHandler);
  615.             removeChild(DisplayObject(textField));
  616.             textField = null;
  617.          }
  618.       }
  619.       
  620.       [Bindable("dataChange")]
  621.       public function get data() : Object
  622.       {
  623.          return _data;
  624.       }
  625.       
  626.       public function set maxChars(param1:int) : void
  627.       {
  628.          if(param1 == _maxChars)
  629.          {
  630.             return;
  631.          }
  632.          _maxChars = param1;
  633.          maxCharsChanged = true;
  634.          invalidateProperties();
  635.          dispatchEvent(new Event("maxCharsChanged"));
  636.       }
  637.       
  638.       public function set horizontalScrollPosition(param1:Number) : void
  639.       {
  640.          if(param1 == _horizontalScrollPosition)
  641.          {
  642.             return;
  643.          }
  644.          _horizontalScrollPosition = param1;
  645.          horizontalScrollPositionChanged = true;
  646.          invalidateProperties();
  647.          dispatchEvent(new Event("horizontalScrollPositionChanged"));
  648.       }
  649.       
  650.       override public function setFocus() : void
  651.       {
  652.          textField.setFocus();
  653.       }
  654.       
  655.       [Bindable("restrictChanged")]
  656.       public function get restrict() : String
  657.       {
  658.          return _restrict;
  659.       }
  660.       
  661.       public function set fontContext(param1:IFlexModuleFactory) : void
  662.       {
  663.          this.moduleFactory = param1;
  664.       }
  665.       
  666.       public function set selectionBeginIndex(param1:int) : void
  667.       {
  668.          _selectionBeginIndex = param1;
  669.          selectionChanged = true;
  670.          invalidateProperties();
  671.       }
  672.       
  673.       public function set selectionEndIndex(param1:int) : void
  674.       {
  675.          _selectionEndIndex = param1;
  676.          selectionChanged = true;
  677.          invalidateProperties();
  678.       }
  679.       
  680.       private function textField_scrollHandler(param1:Event) : void
  681.       {
  682.          _horizontalScrollPosition = textField.scrollH;
  683.       }
  684.       
  685.       public function get textHeight() : Number
  686.       {
  687.          return _textHeight;
  688.       }
  689.       
  690.       public function set editable(param1:Boolean) : void
  691.       {
  692.          if(param1 == _editable)
  693.          {
  694.             return;
  695.          }
  696.          _editable = param1;
  697.          editableChanged = true;
  698.          invalidateProperties();
  699.          dispatchEvent(new Event("editableChanged"));
  700.       }
  701.       
  702.       override protected function commitProperties() : void
  703.       {
  704.          var _loc1_:int = 0;
  705.          super.commitProperties();
  706.          if(hasFontContextChanged() && textField != null)
  707.          {
  708.             _loc1_ = getChildIndex(DisplayObject(textField));
  709.             removeTextField();
  710.             createTextField(_loc1_);
  711.             accessibilityPropertiesChanged = true;
  712.             condenseWhiteChanged = true;
  713.             displayAsPasswordChanged = true;
  714.             enabledChanged = true;
  715.             maxCharsChanged = true;
  716.             restrictChanged = true;
  717.             tabIndexChanged = true;
  718.             textChanged = true;
  719.             selectionChanged = true;
  720.             horizontalScrollPositionChanged = true;
  721.          }
  722.          if(accessibilityPropertiesChanged)
  723.          {
  724.             textField.accessibilityProperties = _accessibilityProperties;
  725.             accessibilityPropertiesChanged = false;
  726.          }
  727.          if(condenseWhiteChanged)
  728.          {
  729.             textField.condenseWhite = _condenseWhite;
  730.             condenseWhiteChanged = false;
  731.          }
  732.          if(displayAsPasswordChanged)
  733.          {
  734.             textField.displayAsPassword = _displayAsPassword;
  735.             displayAsPasswordChanged = false;
  736.          }
  737.          if(enabledChanged || editableChanged)
  738.          {
  739.             textField.type = enabled && _editable ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
  740.             if(enabledChanged)
  741.             {
  742.                if(textField.enabled != enabled)
  743.                {
  744.                   textField.enabled = enabled;
  745.                }
  746.                enabledChanged = false;
  747.             }
  748.             selectableChanged = true;
  749.             editableChanged = false;
  750.          }
  751.          if(selectableChanged)
  752.          {
  753.             if(_editable)
  754.             {
  755.                textField.selectable = enabled;
  756.             }
  757.             else
  758.             {
  759.                textField.selectable = enabled && _selectable;
  760.             }
  761.             selectableChanged = false;
  762.          }
  763.          if(maxCharsChanged)
  764.          {
  765.             textField.maxChars = _maxChars;
  766.             maxCharsChanged = false;
  767.          }
  768.          if(restrictChanged)
  769.          {
  770.             textField.restrict = _restrict;
  771.             restrictChanged = false;
  772.          }
  773.          if(tabIndexChanged)
  774.          {
  775.             textField.tabIndex = _tabIndex;
  776.             tabIndexChanged = false;
  777.          }
  778.          if(textChanged || htmlTextChanged)
  779.          {
  780.             if(isHTML)
  781.             {
  782.                textField.htmlText = explicitHTMLText;
  783.             }
  784.             else
  785.             {
  786.                textField.text = _text;
  787.             }
  788.             textFieldChanged(false,true);
  789.             textChanged = false;
  790.             htmlTextChanged = false;
  791.          }
  792.          if(selectionChanged)
  793.          {
  794.             textField.setSelection(_selectionBeginIndex,_selectionEndIndex);
  795.             selectionChanged = false;
  796.          }
  797.          if(horizontalScrollPositionChanged)
  798.          {
  799.             textField.scrollH = _horizontalScrollPosition;
  800.             horizontalScrollPositionChanged = false;
  801.          }
  802.       }
  803.       
  804.       override public function styleChanged(param1:String) : void
  805.       {
  806.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  807.          super.styleChanged(param1);
  808.          if(_loc2_ || param1 == "borderSkin")
  809.          {
  810.             if(mx_internal::border)
  811.             {
  812.                removeChild(DisplayObject(mx_internal::border));
  813.                border = null;
  814.                createBorder();
  815.             }
  816.          }
  817.       }
  818.       
  819.       private function get isHTML() : Boolean
  820.       {
  821.          return explicitHTMLText != null;
  822.       }
  823.       
  824.       [Bindable("maxCharsChanged")]
  825.       public function get maxChars() : int
  826.       {
  827.          return _maxChars;
  828.       }
  829.       
  830.       public function get maxHorizontalScrollPosition() : Number
  831.       {
  832.          return !!textField ? Number(textField.maxScrollH) : Number(0);
  833.       }
  834.       
  835.       mx_internal function set selectable(param1:Boolean) : void
  836.       {
  837.          if(_selectable == param1)
  838.          {
  839.             return;
  840.          }
  841.          _selectable = param1;
  842.          selectableChanged = true;
  843.          invalidateProperties();
  844.       }
  845.       
  846.       public function get length() : int
  847.       {
  848.          return text != null ? int(text.length) : -1;
  849.       }
  850.       
  851.       public function set listData(param1:BaseListData) : void
  852.       {
  853.          _listData = param1;
  854.       }
  855.       
  856.       private function textField_textModifiedHandler(param1:Event) : void
  857.       {
  858.          textFieldChanged(false,true);
  859.       }
  860.       
  861.       private function textField_textFormatChangeHandler(param1:Event) : void
  862.       {
  863.          textFieldChanged(true,false);
  864.       }
  865.       
  866.       public function set htmlText(param1:String) : void
  867.       {
  868.          textSet = true;
  869.          if(!param1)
  870.          {
  871.             param1 = "";
  872.          }
  873.          _htmlText = param1;
  874.          htmlTextChanged = true;
  875.          _text = null;
  876.          explicitHTMLText = param1;
  877.          invalidateProperties();
  878.          invalidateSize();
  879.          invalidateDisplayList();
  880.          dispatchEvent(new Event("htmlTextChanged"));
  881.       }
  882.       
  883.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  884.       {
  885.          var _loc3_:EdgeMetrics = null;
  886.          super.updateDisplayList(param1,param2);
  887.          if(mx_internal::border)
  888.          {
  889.             mx_internal::border.setActualSize(param1,param2);
  890.             _loc3_ = mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  891.          }
  892.          else
  893.          {
  894.             _loc3_ = EdgeMetrics.EMPTY;
  895.          }
  896.          var _loc4_:Number = getStyle("paddingLeft");
  897.          var _loc5_:Number = getStyle("paddingRight");
  898.          var _loc6_:Number = getStyle("paddingTop");
  899.          var _loc7_:Number = getStyle("paddingBottom");
  900.          var _loc8_:Number = _loc3_.left + _loc3_.right;
  901.          var _loc9_:Number = _loc3_.top + _loc3_.bottom + 1;
  902.          textField.x = _loc3_.left;
  903.          textField.y = _loc3_.top;
  904.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  905.          {
  906.             textField.x += _loc4_;
  907.             textField.y += _loc6_;
  908.             _loc8_ += _loc4_ + _loc5_;
  909.             _loc9_ += _loc6_ + _loc7_;
  910.          }
  911.          textField.width = Math.max(0,param1 - _loc8_);
  912.          textField.height = Math.max(0,param2 - _loc9_);
  913.       }
  914.       
  915.       public function getLineMetrics(param1:int) : TextLineMetrics
  916.       {
  917.          return !!textField ? textField.getLineMetrics(param1) : null;
  918.       }
  919.    }
  920. }
  921.